package daoIpmt;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import beans.TypeMessage;
import dao.TypeMessageDao;
import utils.DataSourceUtils;

public class TypeMessageDaoIpmt implements TypeMessageDao{
	private  DataSource ds=DataSourceUtils.getDataSource();
	private QueryRunner qr=new QueryRunner(ds);
	public TypeMessage getTypeMessageBytype(String type) {
		String sql="select * from typemessage where type=?";
		try {
			TypeMessage TypeMessage = qr.query(sql, new BeanHandler<TypeMessage>(TypeMessage.class),type);
			return TypeMessage;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

}
